using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AITank : TankBase
{
    public float shootTime;
    public Transform[] shootPos;
    public GameObject bullet;

    private float totalTime;

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        if (totalTime > shootTime)
        {
            Fire();
            totalTime -= shootTime;
        }
        totalTime += Time.deltaTime;
    }

    public override void Fire()
    {
        for (var i = 0; i < shootPos.Length; i++)
        {
            GameObject bulletObj = Instantiate(bullet, shootPos[i].position, shootPos[i].rotation);
            //控制子弹的操作
            BulletObj component = bulletObj.GetComponent<BulletObj>();
            component.SetOwn(this);
        }
    }

    public override void Hurt(TankBase other)
    {
        
    }
}